package com.iris.live.services.report.data.orgline;

import com.iris.live.services.report.data.ColumnUnit;
import com.iris.live.services.report.data.ReportContext;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:组织架构轴上下文环境
 * @author: Tony.Zhang
 * @Date: 2017-08-12 14:54
 **/
public class OrglineContext  extends ReportContext {
    //调用前先构建组织结构数据。这部分数据大多数情况下在执行转换前有程序从数据库中获取并构建。
    private List<OrgUnit> orgUnits = new ArrayList<>();

    public OrglineContext() {
    }

    public List<OrgUnit> getOrgUnits() {
        return orgUnits;
    }

    public void setOrgUnits(List<OrgUnit> orgUnits) {
        this.orgUnits = orgUnits;
    }

    public OrglineContext addOrgUnit(OrgUnit orgUnit){
        this.orgUnits.add(orgUnit);
        return this;
    }

    public OrglineContext addOrgUnit(List<OrgUnit> orgUnits){
        this.orgUnits.addAll(orgUnits);
        return this;
    }

    @Override
    public List<? extends ColumnUnit> getColumnUnits() {
        return orgUnits;
    }
}
